import logging
from PyQt5.QtWidgets import QWidget, QFrame
from PyQt5.uic import loadUi

UI_Mapping = {}

class IVacWidget(QFrame):  # component of view and controller
    def __init__(self, parent=None):
        super().__init__(parent)
        self._load_ui_file(self)  # to use cls.__name__

    @classmethod
    def _load_ui_file(cls, parent):
        # print("-->>> {} ".format(cls.__name__))  # 验证：cls.__name__呈现多态（子类类名）
        try:
            loadUi(UI_Mapping[cls.__name__], parent)
        except KeyError:
            logging.error("Unable to find the Page[{}]".format(cls.__name__))


    def _active(self):
        """ 连接信号槽，激活widget模块的功能 """
        pass

    def _import(self):
        """ 载入数据 """
        pass
